This repository has been archived by the owner on Jan 23, 2023. It is now read-only.
[release/3.1] Port fix for JIT silent bad code #27972
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Release/3.1 port of dotnet/runtime#797.
Fixes dotnet/runtime#764
The jit might incorrectly order a read from a struct field with an operation
that modifies the field, so that the read returns the wrong value.
Customer Impact
Silent bad code; program behaves incorrectly.
Regression?
Yes, introduced during the development 3.0 cycle. 2.x behaves correctly.
Testing
Verified the user's test case now passes; no diffs seen in any existing framework
or test code.
Risk
Low: the jit is now spilling the eval stack entries to temps in cases where it
did not before; this should be conservatively safe.
cc @BruceForstall
If we're appending an assignment whose LHS is is a location within a local
struct, we need to spill all references to that struct from the eval stack.
Update the existing logic for this to handle the case where the LHS is a field
of a local struct, and the field is updated by unusual means (here,
initobj
).Fixes dotnet/runtime#764.